mui.init();
var demo = new Vue({
	el: '#main',
	data: {
		lists: []
	},
	methods: {
		toDo: toDo
	},
	ready: function() {
		var applyUrl = getUrl("64getlist");
		var headerJson = getHeader();
		var datastart = "account=" + readData(localStorage.phone) + "&guideId=" + readData(localStorage.guideId) + "&status=start";
		this.$http({
			url: applyUrl,
			method: 'POST',
			headers: headerJson,
			data: datastart
		}).then(function(respons) {
			if (respons.data.code == "0") {				
				var serviceList = respons.data.obj.list;
				for (var i = 0; i < serviceList.length; i++) {
					if (serviceList[i].serviceId == "1") {
						serviceList[i].title = "上门试衣";
					} else {
						serviceList[i].title = "定制改衣";
					}
				}
				this.$set('lists',serviceList);
			} else {
				mui.alert("网络链接异常,请稍后重试" + data.code)
			}
		}, function() {
			console.log('已申请网络链接异常,请稍后重试(e)')
		});
	}
});

function toDo(sid) {
	var tourl = getUrl("63service");
	var headerser = getHeader();
	var datatype = "type=1&id=" + sid;
	demo.$http({
		url: tourl,
		method: 'POST',
		headers: headerser,
		data: datatype
	}).then(function(respons) {
		if (respons.data.code == "0") {
			mui.toast('取消成功');
			setTimeout(function() {
				plus.webview.currentWebview().opener().close();
			}, 500)
		} else {
			mui.alert('网络连接异常,请稍后重试' + data.code, '提示', function(ret, err) {});
		}
	}, function(respons) {
		console.log('取消网络连接异常');
	})
}

